<?php

namespace app\admin\model;

use think\Model;

class Buserfolloe extends Model
{
    // 表名
    protected $name = 'buserfollow';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    
    // 追加属性
    protected $append = [
        'sectionlist_text',
        'currentlist_text',
        'status_text'
    ];

    public function getSectionlistList()
    {
        return ['0' => __('Sectionlist 0'),'1' => __('Sectionlist 1'),'2' => __('Sectionlist 2'),'3' => __('Sectionlist 3'),'4' => __('Sectionlist 4'),'5' => __('Sectionlist 5'),'6' => __('Sectionlist 6')];
    }

    public function getCurrentlistList()
    {
        return ['0' => __('Currentlist 0'),'1' => __('Currentlist 1'),'2' => __('Currentlist 2'),'3' => __('Currentlist 3'),'4' => __('Currentlist 4'),'5' => __('Currentlist 5'),'6' => __('Currentlist 6')];
    }     

    public function getStatusList()
    {
        return ['1' => __('Status 1'),'2' => __('Status 2'),'3' => __('Status 3')];
    }     


    public function getSectionlistTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['sectionlist']) ? $data['sectionlist'] : '');
        $list = $this->getSectionlistList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getCurrentlistTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['currentlist']) ? $data['currentlist'] : '');
        $list = $this->getCurrentlistList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStatusTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




    public function allot()
    {
        return $this->belongsTo('Allot', 'allot_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
    public function admin(){
        return $this->belongsTo('Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0);

    }
    public function buser(){
        return $this->belongsTo('Buser', 'buser_id', 'id', [], 'LEFT')->setEagerlyType(0);

    }
    public function bkuser(){
        return $this->belongsTo('Bkuser', 'buser_id', 'id', [], 'LEFT')->setEagerlyType(0);

    }
    public function product(){
        return $this->belongsTo('Product', 'product_id', 'id', [], 'LEFT')->setEagerlyType(0);

    }
}
